op {
  graph_op_name: "SparseSegmentSumWithNumSegments"
  in_arg {
    name: "indices"
    description: <<END
A 1-D tensor. Has same rank as `segment_ids`.
END
  }
  in_arg {
    name: "segment_ids"
    description: <<END
A 1-D tensor. Values should be sorted and can be repeated.
END
  }
  in_arg {
    name: "num_segments"
    description: <<END
Should equal the number of distinct segment IDs.
END
  }
  out_arg {
    name: "output"
    description: <<END
Has same shape as data, except for dimension 0 which
has size `num_segments`.
END
  }
  summary: "Computes the sum along sparse segments of a tensor."
  description: <<END
Like `SparseSegmentSum`, but allows missing ids in `segment_ids`. If an id is
missing, the `output` tensor at that position will be zeroed.

Read
[the section on segmentation](https://tensorflow.org/api_docs/python/tf/sparse#Segmentation)
for an explanation of segments.

For example:

```python
c = tf.constant([[1,2,3,4], [-1,-2,-3,-4], [5,6,7,8]])

tf.sparse_segment_sum_with_num_segments(
    c, tf.constant([0, 1]), tf.constant([0, 0]), num_segments=3)
# => [[0 0 0 0]
#     [0 0 0 0]
#     [0 0 0 0]]

tf.sparse_segment_sum_with_num_segments(c,
                                        tf.constant([0, 1]),
                                        tf.constant([0, 2],
                                        num_segments=4))
# => [[ 1  2  3  4]
#     [ 0  0  0  0]
#     [-1 -2 -3 -4]
#     [ 0  0  0  0]]
```
END
}
